<template>
  <div class="doctoebianjitop">
    <div class="doctorybianxietitle">
      <div class="diyidoctorybianxie"></div>
      <font>新增医生管理</font>
    </div>
    <div class="dierdoctorybianxie">
      <hr color="#F7FAFD" />
    </div>
    <div class="disandoctorybianxie">
      <font>医生信息</font>
    </div>
    <div class="disidoctorybianxie">
      <table border="0" height="500px" width="100%">
        <tr>
          <td width="68px"><font>账号*</font></td>
          <td width="10px"></td>
          <td width="230px">
              <el-input
              v-model="list.login_num"
              placeholder="请输入内容"
            ></el-input>
          </td>
          <td width="110px"></td>
          <td width="68px"><font>医生头像</font></td>
          <td width="10px"></td>
          <td width="230px">
            上传头像
          </td>
          <td width="110px"></td>
          <td width="68px"><font>医生姓名*</font></td>
          <td width="10px"></td>
          <td width="230px">
              <el-input
              v-model="list.doctor_name"
              placeholder="请输入内容"
            ></el-input>
          </td>
        </tr>

        <tr>
          <td width="62px"><font>医生角色*</font></td>
          <td width="10px"></td>
          <td width="230px">
            <el-select
              v-model="list.doctor_type"
              placeholder="请选择"
              style="width: 230px"
            >
              <el-option
                v-for="item in list1"
                :label="item.doctor_type_name"
                :key="item.doctor_type_id"
                :value="item.doctor_type_id"
              >
              </el-option>
            </el-select>
          </td>
          <td width="110px"></td>
          <td width="62px"><font>登录密码*</font></td>
          <td width="10px"></td>
          <td width="230px">
            <el-input
              v-model="list.login_pwd"
              placeholder="请输入内容"
            ></el-input>
          </td>
          <td width="110px"></td>
          <td width="62px"><font>性别</font></td>
          <td width="10px"></td>
          <td width="230px">
            <el-select
              v-model="list.doctor_sex"
              placeholder="请选择"
              style="width: 220px"
            >
              <el-option
                v-for="item in list3"
                :label="item.label"
                :key="item.value3"
                :value="item.value"
              >
              </el-option>
            </el-select>
          </td>
        </tr>
        <tr>
          <td width="62px"><font>医生简介</font></td>
          <td width="10px"></td>
          <td width="230px" colspan="9" height="100px">
            <el-col style="width: 400px">
              <el-input
                v-model="list.doctor_info"
                type="textarea"
                :rows="6"
              ></el-input>
            </el-col>
          </td>
        </tr>

        <tr>
          <td width="62px"><font>医生擅长</font></td>
          <td width="10px"></td>
          <td width="230px" colspan="9">
            <el-col style="width: 400px">
              <el-input
                type="textarea"
                v-model="list.doctor_adept"
                label-width="90px"
                :rows="6"
              ></el-input>
            </el-col>
          </td>
        </tr>
      </table>
    </div>
    <div class="diwudoctorybianxie">
      <hr color="#F7FAFD" />
    </div>
    <div class="diliudoctorybianxie">
      <router-link to="/datas01">
        <el-button type="primary" @click="adddoctor()">保存</el-button>

        <el-button plain>返回</el-button>
      </router-link>
    </div>
  </div>
</template>

<script>
import axios from "axios";
axios.defaults.baseURL = "http://localhost:8080/";
export default {
  data() {
    return {
      list: {
        login_pwd:"",
        doctor_name:"",
        doctor_type:null,
        login_num:"",
        doctor_sex:null,
        doctor_info:"",
        doctor_adept:"",
      },
      list1: "",
      value1: "",

      list3: [
        {
          value: 1,
          label: "男",
        },
        {
          value: 2,
          label: "女",
        },
      ],
      value3: "", //服务团队
    };
  },
  methods: {
    adddoctor() {
      axios({
        url: "doctor/adddoctor",
        method: "POST",
        params: {
          user: this.list,
        },
      }).then((res) => {
        this.$notify({
          title: "成功",
          message: "新增成功",
          type: "success",
        });
      });
    },
    // quertList() {
    //   axios({
    //     url: "doctor/getDoctorById",
    //     method: "GET",
    //     params: {
    //       id: this.$route.query.id,
    //     },
    //   }).then((res) => {
    //     this.list = res.data; //把值传到list里面
    //   });
    // },
    query1() {
      axios({
        url: "/doctor/getDoctor",
        method: "GET",
      }).then((res) => {
        this.list1 = res.data; //把值传到list里面
      });
    },
  },
  created() {
    this.query1(),
      this.quertList(),
      document
        .querySelector("body")
        .setAttribute("style", "background-color:#F2F7FB");
  },
};
</script>

<style>
.diliudoctorybianxie {
  float: left;
  width: 96%;
  height: 60px;
  margin-left: 2%;
  /* background-color: red; */
  margin-top: -6%;
}
.diwudoctorybianxie {
  float: left;
  width: 96%;
  height: 100px;
  margin-left: 2%;
  /* background-color: red; */
}
.disidoctorybianxie font {
  color: #9999a6;
}
.disidoctorybianxie {
  float: left;
  width: 96%;
  /* height: 100px; */
  margin-left: 2%;
  /* background-color: red; */
  margin-top: 2%;
  font-size: 13px;
}
.disandoctorybianxie {
  float: left;
  width: 98%;
  height: 20px;
  margin-left: 2%;
  font-size: 16px;
  margin-top: 2%;
}
.dierdoctorybianxie {
  float: left;
  height: 10px;
  width: 96%;
  margin-left: 2%;
  margin-top: 1.5%;
  /* background-color: blue; */
}
.diyidoctorybianxie {
  width: 6px;
  height: 20px;
  background-color: #2984f8;
  border-radius: 5px;
  margin-left: 2%;
  display: inline-block;
  margin-right: 10px;
}
.doctorybianxietitle {
  width: 100%;
  height: 40px;
  font-size: 18px;
  display: flex;
  align-items: center;
  /* background: rgb(255, 214, 214); */
}
.doctoebianjitop {
  width: 1150px;
  height: 730px;
  background: white;
  margin: 20px auto;
}
</style>